Skip to content

Fix a short frame crash and some response bytes in the VT server - #978

Open
sujandumaru wants to merge 1 commit into
mainfrom
sujan/vt-server-wire-fixes
Open

sujandumaru wants to merge 1 commit into
mainfrom
sujan/vt-server-wire-fixes

Conversation

@sujandumaru

Copy link
Copy Markdown
Member

A 6 byte Working Set Member frame starting with 0xB3 could crash VirtualTerminalServer. Only Change String Value is allowed to be that short, but the check did not look at the PGN. It does now.

There was also few places where the server did not follow ISO 11783:

Message Before Now
Execute Macro response error code in byte 4 byte 3 (11783-6:2018 F.49)
Hide/Show Object with a value above 1 shows the object command error, nothing changes
Change Child Location with offset 255 moves the child by -128 moves it by +128
Get Supported Widechars error "any other error" was 0x08, ranges still sent 0x10 with no ranges (D.11)
ACK/NACK priority 7 priority 6
End of Object Pool without a pool no response error response (C.2.5), then object_pool_deleted() and suspend_working_set()

offset_all_children_with_id() takes int16_t offsets now, as +128 does not fit in int8_t.

Added unit tests for these.

@sujandumaru sujandumaru added bug Something isn't working iso: virtual terminal Related to the ISO-11783:6 standard labels Nov 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

@gunicsba gunicsba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I checked this against ISO 11783-6:2018, and the changes match:

  • F.49 Execute Macro response: error codes in byte 3. F.63 Execute Extended Macro response: error codes in byte 4.
  • F.2 Hide/Show Object: byte 4 is only 0 = Hide or 1 = Show, so other values get Command error (F.3 byte 5 bit 2).
  • F.14 Change Child Location: "255 = a + 128 pixel move", which needs the int16_t offset.
  • D.11 Get Supported WideChars response: Any other error is bit 4, and the number of ranges is "set to 0 if Error codes is not equal to 0".
  • C.2.5: after an error the VT should delete the pool and inform the operator of the suspension, which remove_object_pool() does for an End of Object Pool without a pool.

One question inline about the error code of that response.

🤖 Generated with Claude Code

LOG_WARNING("[VT Server]: End of object pool message ignored - no object pools are loaded for the source control function");
LOG_WARNING("[VT Server]: End of object pool message rejected - no object pools are loaded for the source control function");
remove_object_pool(managedWorkingSet);
send_end_of_object_pool_response(false, NULL_OBJECT_ID, NULL_OBJECT_ID, get_bit(static_cast<std::uint8_t>(ObjectPoolErrorBit::AnyOtherError)), message.get_source_control_function(), false, &pendingObjectPoolDeletions.back().failure);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pool is deleted here, so should byte 7 also have bit 3 "object pool was deleted from volatile memory" (C.2.5), like the dropped transfer case just above? Right now only bit 2 "any other error" is set, so the client isn't told that the pool is gone.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working iso: virtual terminal Related to the ISO-11783:6 standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants